<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/4/18/018
 * Time: 10:47
 */

namespace app\api\controller;

use app\api\model\SearchWord as Word;
use think\Controller;

class Searchword extends Base
{
    //获取指定用户搜索过的关键字
    public function getList($id)
    {
        $data = Word::getList($id);
        return self::apiResp($data);
    }

    //删除关键字
    public function deleteWord($id)
    {
        $word = new Word();
        $res = $word->where('user_id',$id)->delete();
        if($res){
            $res = ['_code'=>'200','msg'=>'删除成功'];
        }else{
            $res = ['_code'=>'400','msg'=>'删除失败'];
        }
        return self::apiResp($res);
    }
}